# -*- coding = utf-8 -*-
# @Time : 2021/7/15 10:22
# @Author : 龙王赘婿_彪少
# @File : testBs45.py
# @Software: PyCharm


from bs4 import BeautifulSoup
import re

file = open("./baidu.html", "rb")
myhtml = file.read().decode("utf-8")

# 解析器 变成树结构
bs = BeautifulSoup(myhtml, "html.parser")

#4.只获取三个
t_list = bs.find_all("a", limit=3)

for item in t_list:
    print(item)